package com.cjd.common.utils

import android.text.TextUtils
import com.google.gson.Gson

/**
 * @Author chenjidong
 * @email 374122600@qq.com
 * created 2019/7/3
 * description
 */
object GsonUtils {

    @JvmStatic
    private var gson: Gson? = null

    @JvmStatic
    fun instance(): Gson {
        if (gson == null)
            gson = Gson()
        return gson as Gson
    }

    fun isJson(str: String): Boolean {
        if (!TextUtils.isEmpty(str)) {
            if (str.startsWith("{") && str.endsWith("}")) {
                return true
            }
        }
        return false
    }
}